﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TagModule.cs" company="Concept Architecture">
//   (c) 2010 Muhammad Umer Farooq
// </copyright>
// <summary>
//   Defines the <seealso cref="TagModule" /> type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Hisaab.Client.Modules.Core.Tag
{
    using Common;
    using Microsoft.Practices.Prism.Modularity;
    using Microsoft.Practices.Prism.Regions;
    using Microsoft.Practices.ServiceLocation;
    using Microsoft.Practices.Unity;
    using View;

    /// <summary>
    /// Defines the <seealso cref="TagModule"/> type.
    /// </summary>
    public class TagModule : IModule
    {
        #region Data Members

        /// <summary>
        /// Member variable TagEditor
        /// </summary>
        public const string TagEditor = "TagEditor";

        /// <summary>
        /// Member variable TagView
        /// </summary>
        public const string TagView = "Tag";

        /// <summary>
        /// Member variable TagsView
        /// </summary>
        public const string TagsView = "Tags";

        /// <summary>
        /// Member variable ModuleName
        /// </summary>
        public const string ModuleName = "TagModule";

        /// <summary>
        /// Member variable TagsTab
        /// </summary>
        public const string TagsTab = "TagsTab";

        #endregion Data Members

        /// <summary>
        /// Initializes this instance.
        /// </summary>
        public void Initialize()
        {
            var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
            regionManager.RegisterViewWithRegion(Regions.HomeAddGroup, typeof(TagAddButton));
            regionManager.RegisterViewWithRegion(Regions.HomeListGroup, typeof(TagViewButton));
            regionManager.RegisterViewWithRegion(Regions.RibbonRegion, typeof(TagsTab));
            regionManager.RegisterViewWithRegion(Regions.NavigationRegion, typeof(TagNavigation));

            var container = ServiceLocator.Current.GetInstance<IUnityContainer>();
            container.RegisterType<object, TagsTab>(TagsTab);
            container.RegisterType<object, TagEditor>(TagEditor);
            container.RegisterType<object, TagsView>(TagsView);
            container.RegisterType<object, TagView>(TagView);
        }
    }
}